<script language="javascript" src="<?php echo JQUERYUI?>jquery.ui.mouse.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI?>jquery.ui.draggable.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI?>jquery.ui.position.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI?>jquery.ui.resizable.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI?>jquery.ui.dialog.min.js"></script>
<script>
$(document).ready(function() {
    $( ".date" ).datepicker();
	$( ".date" ).datepicker( "option", "dateFormat", "dd-mm-yy");
	$( "#tgl_awal" ).change(function(){
			location.href = "<?php echo PENKASIR ?>list_result/"+$('#tgl_awal').val()+"/"+$('#tgl_akhir').val();
	});
	$( "#tgl_akhir" ).change(function(){
			location.href = "<?php echo PENKASIR ?>list_result/"+$('#tgl_awal').val()+"/"+$('#tgl_akhir').val();
	});
	list_table = $('#list_penerimaan_kasir').dataTable({
			"bFilter" : true,
			"bJQueryUI" : true,
			"aLengthMenu": [[10,25,50, 100, -1], [10,25,50,100, "Semua"]],
			"sPaginationType": "full_numbers",
			"oLanguage": {
				"sLengthMenu": "Menampilkan _MENU_ data",
				"sZeroRecords": "Belum ada data penerimaan kasir yang tersimpan",
				"sInfoFiltered": "(Hasil filter dari _MAX_ yang didapat)"
			}
		});
		$('#list_penerimaan_kasir_filter').hide();
		
	$( "#cetak_pdf" ).click(function(){
		tgl_awal = $( "#tgl_awal" ).val();
		tgl_akhir = $( "#tgl_akhir" ).val();
		location.href="<?php echo PENKASIR?>cetak_pdf/"+tgl_awal+"/"+tgl_akhir;
	});
	$( "#cetak_excel" ).click(function(){
		tgl_awal = $( "#tgl_awal" ).val();
		tgl_akhir = $( "#tgl_akhir" ).val();
		location.href="<?php echo PENKASIR?>cetak_excel/"+tgl_awal+"/"+tgl_akhir;
	});
} );
</script>
<?php
$data['cur_parent_menu']='laporan';
$data['cur_selected_menu']='penkasir';
$this->load->view('template/menu_view',$data);
?>
<br/><br/><br/><br/><br/><br/>
<table width="1000" align="center">
	<tr>
		<td width="500">
			&nbsp;
		</td>
		<td width="500" align="left">
			Tgl Awal : <input type="text" class="date" id="tgl_awal" value="<?php echo $tgl_awal?>"/>
			Tgl Akhir : <input type="text" class="date" id="tgl_akhir" value="<?php echo $tgl_akhir?>"/>
		</td>
	</tr>
</table>
<br/>
Cetak : <span class="clicked" id="cetak_pdf">PDF</span> <span class="clicked" id="cetak_excel">Excel</span>
<br/>
<table id="list_penerimaan_kasir" width="100%" align="center" border="0">
	<thead>
		<tr>
			<th>No</th>
                        <th>Nama Kasir</th>
                        <th>Cabang</th>
                        <th>Telp.</th>
                        <th>Total Tiket</th>
                        <th>Total Tiket Void</th>
                        <th>Total Omset</th>
                        <th>Total Discount</th>
                        <th>Total Fee Agen</th>
                        <th>Total Void</th>
                        <th>Total Biaya Langsung</th>
                        <th>Total Setor</th>
		</tr>
	</thead>
	<tbody>
		<?php 
                $sum['total_void'] = '';
                $sum['total_omset'] = '';
                $sum['total_discount'] = '';
                $sum['fee_agen'] = '';
                $sum['total_biaya_langsung'] = '';
                $sum['total_setoran'] = '';
                for($i=0;$i<count($list_result);$i++){?>
		<tr>
			<td><?php echo $i+1?></td>
			<td><?php echo $list_result[$i]['nama']?></td>
			<td><?php echo $cabang[$i]['Nama']?></td>
			<td><?php echo $cabang[$i]['Telp']?></td>
			<td><?php echo $detail[$i]['total_penumpang']?></td>
			<td><?php echo $detail[$i]['tiket_void']?></td>
			<td><?php $sum['total_omset'] += $detail[$i]['total_omset']; echo $detail[$i]['total_omset']?></td>
			<td><?php $sum['total_discount'] += $detail[$i]['total_discount']; echo $detail[$i]['total_discount']?></td>
			<td><?php $sum['fee_agen'] += $detail[$i]['fee_agen']; echo $detail[$i]['fee_agen']?></td>
			<td><?php $sum['total_void'] += $detail[$i]['total_void']; echo $detail[$i]['total_void']?></td>
			<td><?php $sum['total_biaya_langsung'] += $detail[$i]['jumlah']; echo $detail[$i]['jumlah']?></td>
			<td><?php $sum['total_setoran'] += $detail[$i]['total_setoran']; echo $detail[$i]['total_setoran']?></td>
		</tr>
		<?php }
                ?>
                <tr>
                    <td>Total</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td><?php echo $sum['total_omset']?></td>
                    <td><?php echo $sum['total_discount']?></td>
                    <td><?php echo $sum['fee_agen']?></td>
                    <td><?php echo $sum['total_void']?></td>
                    <td><?php echo $sum['total_biaya_langsung']?></td>
                    <td><?php echo $sum['total_setoran']?></td>
                </tr>
	</tbody>
</table>